#pragma once
#include "dbbase.h"

class CMembersDb :
    public CDbBase
{
public:
    CMembersDb(void);
    ~CMembersDb(void);

    DWORD Open(void);
    DWORD
    Add(
        UINT GroupId,
        CEOID ContactId,
        PROPID ContactNumberPropId,
        UINT *pAssignedId);
    DWORD
    Get(
        UINT Index,
        UINT *pId,
        UINT *pGroupId,
        CEOID *pContactId,
        PROPID *pContactNumberPropId);
    DWORD
    Set(
        UINT Index,
        CEOID ContactId,
        CEPROPID ContactNumberPropId);
    DWORD DeleteByGroupId(UINT GroupId);
    DWORD
    GetFromId(
        UINT Id,
        UINT *pGroupId,
        CEOID *pContactId,
        PROPID *pNumberPropId,
        UINT *pIndex);
    DWORD CopyFromId(UINT IdDest, UINT IdSrc);

private:
    struct Record
    {
        UINT Id;
        UINT GroupId;
        CEOID ContactId;
        PROPID ContactNumberPropId;
    };

    static const TCHAR *DB_NAME;

    UINT m_MaxId;
};
